﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

using CustomControlDatabaseInterface.ViewModel.Interfaces;

namespace CustomControlDatabaseInterface.ViewModel
{
    public class CustomerDetailControlDetailViewModel : ViewModelBase  {

        public string statusColor;

        public String StatusColor {
            get {
                return statusColor;
            }
            private set {
                statusColor = value;
                OnPropertyChanged("StatusColor");
            }
        }

        private String controlName; 
        public String ControlName {
            get {
                return controlName;
            }
            set {
                if (value != null) {
                    controlName = value; 
                }
                
            }
        }

        public void Save() {
            StatusColor = "neutral";
        }

        public CustomerDetailControlDetailViewModel() {
            
        }

        public CustomerDetailControlDetailViewModel( String controlName) {
            ControlName = controlName;
            RemoveControlCommand = new RelayCommand(param => OnRemoveControlCommand());
        }

        public ICommand RemoveControlCommand { get; set; }

        public delegate void RemoveControlEventHandler(CustomerDetailControlDetailViewModel controlDetail);

        public event RemoveControlEventHandler RemoveControl; 

        public void OnRemoveControlCommand() {
            RemoveControlEventHandler handler = this.RemoveControl;
            if (RemoveControl != null) {
                handler(this);
            }
        }
    }
}
